package com.mytest;

import java.sql.Time;
import java.util.concurrent.TimeUnit;

public class Demo05 {

    public static void main(String[] args) throws InterruptedException {
        Resource resource = new Resource();

        for (int i = 0; i < 20; i++) {

            TimeUnit.SECONDS.sleep(1);

            new Thread(() -> {
                resource.getTicket();
            }).start();
        }
    }
}
